<template>
	<view class="container">
		<view class="fgx"></view>
		<view class="">
			<u-form :model="model" :rules="rules" ref="uForm" :errorType="errorType">
				
				<u-form-item label="产业" :required="required" prop="industry">
					<view style="width:100%;text-align: right;"  @click="cySelect">{{model.industry || "请选择产业"}}</view>					
					<TriTree ref="cyTree" :multiple="false" :range="fetchDict.industry" @confirm="function (e){return setChooseType(e,'industry')}"></TriTree>
				</u-form-item>
				<u-form-item :label-width="200" :required="required" :label-position="labelPosition" label="企业名称" prop="name">
					<u-input :border="border" placeholder="请输入" v-model="model.name" type="text" input-align="right"></u-input>
				</u-form-item>
				<u-form-item :required="required" :label-width="200" :label-position="labelPosition" :border-bottom="true" label="企业身份" prop="corporateIdentity">
					<view style="width:100%;text-align: right;" @click="qySelect">{{model.corporateIdentity || "请选择"}}</view>
				</u-form-item>
				<u-form-item :label-width="200" :required="required" :label-position="labelPosition" label="企业性质" prop="type">
					<u-input type="select" :select-open="selectShowQyxz" v-model="model.type" placeholder="请选择" placeholderStyle="color: #0D1D36;"
					 input-align="right" @click="selectShowQyxz = true"></u-input>
				</u-form-item>
				<view class="sctp u-m-l-20 u-m-r-30 u-m-t-40">
					<text class="hz"><!-- <text style="color: #ED6A29;padding-top: 2px;">*</text> -->上传执照</text>
					<text class="sm">1.执照不得有遮挡，保证字迹清晰 2.请在白色背景下拍摄，保证执照身份证边缘清晰 3.请在执照的正上方拍摄，防止画面变形</text>
				</view>
				<u-form-item class="u-m-r-30 " :label-position="labelPosition" prop="photo" label-width="150">
					<u-upload ref="uUpload" @on-uploaded="onUploaded" :custom-btn="customBtn" :show-upload-list="showUploadList"
					 :action="action" :auto-upload="autoUpload" :file-list="fileList" @on-remove="onRemove" :show-progress="showProgress"
					 :deletable="deletable" :max-count="maxCount" :site="baseUrl">
						<view v-if="customBtn" slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
							<u-icon name="photo" size="60" :color="$u.color['lightColor']"></u-icon>
						</view>
					</u-upload>

					<!-- <u-upload  v-model="model.sczz" width="160"></u-upload> -->
				</u-form-item>
				<view class="gsdw" @click="getAddress">
					<image class="picture" src="../../static/register/dw.png" mode=""></image>
					<text class="hz">获取公司地址</text>
				</view>
				<u-form-item :required="required" label-width="150" :label-position="labelPosition" label="企业地址" prop="address">
					<u-input :border="border" placeholder="请输入" v-model="model.address" type="text" input-align="right"></u-input>
				</u-form-item>
				<u-form-item :label-width="200" :label-position="labelPosition" label="企业资质" prop="qualification_merge">
					<u-input type="text" v-model="model.qualification_merge" placeholder="请输入" input-align="right"></u-input>
					<view style="width:100%;text-align: right;" @click="qyzzSelect">{{model.enterpriseQualification || "请选择"}}</view>
				</u-form-item>
				<view class="sctp u-m-l-30 u-m-t-40">
					<text class="hz">上传企业资质照片</text>
					<text class="sm">请在正上方拍摄，不得有遮挡，保证字迹、边缘清晰。</text>
				</view>
				<u-form-item :label-position="labelPosition" prop="photo" label-width="150">
					<u-upload ref="uUpload" @on-uploaded="onUploadedZz" :custom-btn="customBtn" :show-upload-list="showUploadList"
					 :action="action" :auto-upload="autoUpload" :file-list="photos" @on-remove="onRemove" :show-progress="showProgress"
					 :deletable="deletable" max-count="9" :site="baseUrl">
						<view v-if="customBtn" slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
							<u-icon name="photo" size="60" :color="$u.color['lightColor']"></u-icon>
						</view>
					</u-upload>
				
					<!-- <u-upload v-model="zltxzp" width="160"></u-upload> -->
				</u-form-item>
				<u-form-item  :label-width="200" :label-position="labelPosition" label="质量体系" prop="quality">
					<u-input type="text" v-model="model.quality" placeholder="请输入" input-align="right"></u-input>
				</u-form-item>
				<view class="sctp u-m-l-30 u-m-t-40">
					<text class="hz">上传质量体系照片</text>
					<text class="sm">请在正上方拍摄，不得有遮挡，保证字迹、边缘清晰。</text>
				</view>
				<u-form-item :label-position="labelPosition" prop="photo" label-width="150">
					<u-upload ref="uUpload" @on-uploaded="onUploadedZl" :custom-btn="customBtn" :show-upload-list="showUploadList"
					 :action="action" :auto-upload="autoUpload" :file-list="photos" @on-remove="onRemove" :show-progress="showProgress"
					 :deletable="deletable" :max-count="maxCount" :site="baseUrl">
						<view v-if="customBtn" slot="addBtn" class="slot-btn" hover-class="slot-btn__hover" hover-stay-time="150">
							<u-icon name="photo" size="60" :color="$u.color['lightColor']"></u-icon>
						</view>
					</u-upload>

					<!-- <u-upload v-model="zltxzp" width="160"></u-upload> -->
				</u-form-item>
				<u-form-item :required="required" :label-width="200" :label-position="labelPosition" label="擅长领域" prop="specials">
					<!-- 		<u-input
							type="select"
							:select-open="selectShowScly"
							v-model="model.specials"
							placeholder="请选择"
							placeholderStyle="color: #0D1D36;"
							input-align="right"
							@click="selectShowScly = true"
						></u-input> -->
					<view style="width:100%;text-align: right;" @click="mSelect">{{model.specials || "请选择"}}</view>

				</u-form-item>

				<u-form-item :required="required" :label-width="200" :label-position="labelPosition" label="人员规模" prop="scale">
					<u-input :border="border" placeholder="请输入" v-model="model.scale" type="number" input-align="right"></u-input>
				</u-form-item>
				<u-form-item :label-position="labelPosition" :label-width="200" label="赞助申请" label-width="495" prop="support">
					<u-radio-group v-model="model.support" @change="checkboxGroupChange" :width="radioCheckWidth" :wrap="radioCheckWrap">
						<u-radio shape="square" v-model="item.checked" v-for="(item, index) in checkboxList" :key="index" :name="item.name">{{ item.name }}</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item :label-position="labelPosition" :label-width="200" label="接受应聘" label-width="495" prop="acceptRecruit">
					<u-radio-group v-model="model.acceptRecruit" @change="checkboxGroupChange1" :width="radioCheckWidth" :wrap="radioCheckWrap">
						<u-radio shape="square" v-model="item.acceptRecruit" v-for="(item, index) in checkboxList1" :key="index" :name="item.name">{{ item.name }}</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item :label-position="labelPosition" :required="required" :label-width="200" label="联系人" prop="contactName">
					<u-input :border="border" placeholder="请输入" v-model="model.contactName" type="text" input-align="right"></u-input>
				</u-form-item>
				<u-form-item :label-position="labelPosition" :required="required" :label-width="200" label="联系电话" prop="contactPhone">
					<u-input :border="border" placeholder="请输入" v-model="model.contactPhone" type="text" input-align="right"></u-input>
				</u-form-item>
				<u-form-item :label-position="labelPosition" :label-width="200" label="企业邮箱" prop="mail">
					<u-input :border="border" placeholder="请输入" v-model="model.mail" type="text" input-align="right"></u-input>
				</u-form-item>
				<u-form-item :label-width="200" :label-position="labelPosition" label="档期" prop="schedule" style="padding-bottom:10rpx;" :border-bottom="false">
					<u-input :border="border" @click="show = true" placeholder="请选择" v-model="model.schedule" type="text" input-align="right"></u-input>
					<u-calendar v-model="show" ref="calendar" @change="change" :mode="mode" :start-text="startText" :end-text="endText"
					 :range-color="rangeColor" max-date="2022-10-01" :range-bg-color="rangeBgColor" :active-bg-color="activeBgColor">
					</u-calendar>
				</u-form-item>
				<view class="u-p-l-30 u-p-r-30 u-p-b-30 u-border-bottom u-flex u-row-right">
					<text style="color: #9da2b0;">表示此段时间忙碌不接受新合作</text>
				</view>	
				<u-form-item :label-position="labelPosition" :label-width="200" label="自定义展示" prop="customize">
					<view style="flex: 1;text-align: right;" @click="handleClickCustom(model.customize)"><text style="color: #9da2b0;">请慎重，如无设置系统默认全部</text>
						<u-icon name="arrow-right" style="color:#9DA2B0;font-size: 32upx;"></u-icon>
					</view>
				</u-form-item>
				<!-- <u-form-item :label-position="labelPosition" :label-width="200" label="匹配权重" prop="customize">
					<view style="flex: 1;text-align: right;" @click="handleClickWeight()">
						<u-icon name="arrow-right" style="color:#9DA2B0;font-size: 32upx;"></u-icon>
					</view>
				</u-form-item> -->
				<u-form-item class="u-border-bottom" :label-width="200" label="自评标签" :border-bottom="false" prop="selfTag">
					<scroll-view class="scroll-view_H" scroll-x="true" scroll-left="0">
						<u-tag v-for="(item,index) in tagList" style="padding: 12upx 16upx;margin-right: 15upx;" :text="item" mode="plain"
						 :key="index" shape="circle" closeable @close="tagClick(index)" />
					</scroll-view>
					<u-button type="primary" style="height: 50upx;border-radius: 22upx;width: 120upx;margin: 0;margin-left: auto;"
					 @click="popupActive = true">
						<u-icon name="plus"></u-icon>添加
					</u-button>
				</u-form-item>
				<!-- u-form-item :label-position="labelPosition" label="自评标签" prop="selfEvaluation">
						<u-input :border="border" placeholder="请输入" v-model="model.selfEvaluation" type="text" input-align="right"></u-input>
					</u-form-item> -->
				<view class="sctp u-m-l-30 u-m-r-30 u-m-t-40"><text class="hz">自我评价</text></view>
				<u-form-item class="zwpj u-m-l-30 u-m-r-30" :label-position="labelPosition" prop="introduction">
					<u-input type="textarea" :border="border" placeholder="请填写简介" v-model="model.introduction" />
				</u-form-item>
			</u-form>
		</view>
		<view class="u-m-t-20 u-p-30">
			<u-button class="button" @click="submit">提交</u-button>
			<!--弹出框-->
			<u-select mode="single-column" :list="fetchDict.company_nature" v-model="selectShowQyxz" @confirm="selectConfirmQyxz"></u-select>
			<u-select mode="single-column" :list="fetchDict.company_type" value-name="id" label-name="name" v-model="selectQyfl"
			 @confirm="confirmQyfl"></u-select>
			<u-select mode="single-column" :list="fetchDict.quality_system" value-name="id" label-name="name" v-model="selectShowZltx"
			 @confirm="selectConfirmZltx"></u-select>
			<u-select mode="single-column" :list="fetchDict.areas_of_expertise" value-name="id" label-name="name" v-model="selectShowScly"
			 @confirm="selectConfirmScly"></u-select>
			 <TriTree ref="qyzzTree" :range="fetchDict.qualification_merge" @confirm="function (e){return setChooseType(e,'enterpriseQualification')}"></TriTree>
			 <TriTree ref="qyTree" :range="fetchDict.company_type" @confirm="function (e){return setChooseType(e,'corporateIdentity')}"></TriTree>
			<TriTree ref="triTree" :range="fetchDict.all_adept_field" @confirm="function (e){return setChooseType(e,'specials')}"></TriTree>
			<!--弹出框-->
		</view>
		<u-popup v-model="popupActive" mode="center">
			<view class="view-popup u-p-20">
				<view style="margin-bottom: 20upx;">添加标签</view>
				<u-input v-model="tagValue" placeholder="请输入标签" :border="true" />
				<view style="display: flex;margin-top: 20upx;">
					<u-button style="height: 60upx;" @click="popupActive = false">取消</u-button>
					<u-button style="height: 60upx;" @click="handleAddTag" type="primary">确认</u-button>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import TriTree from '@/components/tki-tree/tki-tree.vue'
	export default {
		components: {
			TriTree
		},
		data() {
			return {
				index: 0,
				industryShow: false,
				rangKey: 'categoryType',
				baseUrl: this.$mConfig.baseUrl,
				logoMask: this.$mAssetsPath.logoMask,
				showDate: false,
				show: false,
				mode: 'range',
				result: "请选择日期",
				startText: '开始',
				endText: '结束',
				rangeColor: '#2979ff',
				rangeBgColor: 'rgba(41,121,255,0.13)',
				activeBgColor: '#2979ff',
				selectQyfl: false,
				tagList: [],
				fetchDict: [],
				tagValue: '',
				infoList: [],
				fileList: [],
				fileListZl: [],
				fileListZz: [],
				photos: [],
				popupActive: false,
				showUploadList: true,
				customBtn: false,
				autoUpload: true,
				showProgress: false,
				deletable: true,
				customStyle: false,
				maxCount: 9,
				lists: [], // 组件内部的文件列表
				filePaths: '', // 文件路径
				filePathsZl: '', // 文件路径
				filePathsZz: '', // 文件路径
				fileNames: '', // 文件名称
				avatar: this.$mAssetsPath.avatar,
				action: this.$apis.uploadFile,
				/**
				 * form验证
				 * */
				model: {
					name: '',
					industry: '',
					quality: '',
					qualityUrl: '',
					specials: '',
					scale: '',
					contactName: '',
					sex: '',
					introduction: '',
					contactPhone: '',
					address:'',
					type:'',
				},
				reqBody: {},
				selectList: [],
				selectListZLTX: [],
				selectListSCLY: [],
				rules: {
					name: [{
						required: true,
						message: '请输入企业名称',
						trigger: 'blur'
					}],
					industry: [{
						required: true,
						message: '请选择企业分类',
						trigger: 'change'
					}],
					type: [{
						required: true,
						message: '请选择企业性质',
						trigger: 'change'
					}],
					// sczz: [{
					// 	required: true,
					// 	message: '请上传执照',
					// 	trigger: 'change'
					// }],
					address: [{
						required: true,
						message: '请输入企业地址',
						trigger: 'blur'
					}],
					// quality: [{
					// 	required: true,
					// 	message: '请输入质量体系',
					// 	trigger: 'blur'
					// }],
					// qualityUrl: [{
					// 	required: true,
					// 	message: '请上传质量体系照片',
					// 	trigger: 'blur'
					// }],
					specials: [{
						required: true,
						message: '请选择擅长领域',
						trigger: 'change'
					}],
					scale: [{
						required: true,
						message: '请选择人员规模',
						trigger: 'change'
					}],
					contactName: [{
						required: true,
						message: '请输入联系人',
						trigger: 'blur'
					}],
					contactPhone: [{
							required: true,
							message: '请输入手机号',
							trigger: ['change', 'blur']
						},
						{
							validator: (rule, value, callback) => {
								// 调用uView自带的js验证规则，详见：https://www.uviewui.com/js/test.html
								return this.$u.test.mobile(value);
							},
							message: '手机号码不正确',
							// 触发器可以同时用blur和change，二者之间用英文逗号隔开
							trigger: ['change', 'blur']
						}
					]
				},
				required: true,
				border: false,
				check: false,
				selectStatus: 'close',
				selectShowQyxz: false,
				selectShowZltx: false,
				selectShowScly: false,
				radio: '',
				radio1: '',
				radioCheckWidth: 'auto',
				radioCheckWrap: false,
				labelPosition: 'left',
				codeTips: '',
				errorType: ['toast'],
				checkboxList: [{
						name: '是',
						checked: false,
						disabled: false
					},
					{
						name: '否',
						checked: false,
						disabled: false
					}
				],
				checkboxList1: [{
						name: '是',
						checked: false,
						disabled: false
					},
					{
						name: '否',
						checked: false,
						disabled: false
					}
				]
			};
		},
		watch: {
			tagList(val) {
				this.model.selfTag = val.join(',')
			}
		},
		onLoad(options) {
			if (options.id) {
				this.model.id = options.id;
			}

			if (options.row) {
				console.log(options.row);
				this.model = JSON.parse(decodeURIComponent(options.row));
				if(this.model.qualificationUrl != null && this.model.qualificationUrl != undefined){					
					this.fileList = [{
						'url': this.baseUrl + this.model.qualificationUrl
					}]
				}
				if(this.model.qualityUrl != null && this.model.qualityUrl != undefined){
					this.photos = [{
						'url': this.baseUrl + this.model.qualityUrl
					}]
				}
			} else {
				
				var keys = {'keys':['company_nature','company_type','quality_system','size_personnel','qualification_merge','industry','all_adept_field','qualification_merge']}
				this.dictionaryFetchDict(keys);
				
				// this.dictionaryFetchDict('company_nature'); //企业性质
				// this.dictionaryFetchDict('company_type'); //企业分类
				// this.dictionaryFetchDict('quality_system'); //质量体系
				// this.dictionaryFetchDict('all_adept_field'); //擅长领域
				// this.dictionaryFetchDict('size_personnel'); //人员规模		
				// this.dictionaryFetchDict('qualification_merge'); //企业资质
			}

		},
		created() {
			// 监听从裁剪页发布的事件，获得裁剪结果
			uni.$on('uAvatarCropper', path => {

				// 可以在此上传到服务端
				uni.uploadFile({
					url: this.$apis.uploadFile,
					filePath: path,
					name: 'file',
					complete: (res) => {
						let img = JSON.parse(res.data);
						console.log(res);
						this.model.imgUrl = img.message;
						this.avatar = this.baseUrl + img.message;
					}
				});
			})
		},
		// 必须要在onReady生命周期，因为onLoad生命周期组件可能尚未创建完毕
		onReady() {
			this.$refs.uForm.setRules(this.rules);
		},
		methods: {
			qyzzSelect() {
				this.$refs.qyzzTree._show()
			},
			cySelect() {
				this.$refs.cyTree._show()
			},
			qySelect() {
				this.$refs.qyTree._show()
			},	
			bindPickerChange: function(e) {
				this.model.scale = this.fetchDict.size_personnel[e.target.value].label;
				this.index = e.target.value
			},
			confirm(e, list, type) {
				var itemKey = e[0];
				var value = '';
				if (type == "identityType") {
					value = itemKey;
					this.identityType = list[itemKey];
				} else {
					value = list[itemKey]['categoryType'];
				}
				this.model[type] = value;
			},
			setChooseType(item, type) {
				console.log("column_array", item, type);
				var column_array = this.$mUtils.array_column(item, 'label');
				var modelValue = column_array.join(',');
				this.model[type] = modelValue;
				this.model[type + "List"] = item;
				this.$forceUpdate()
			},
			mSelect() {
				this.$refs.triTree._show()
				this.$forceUpdate()
			},
			getAddress() {
				var that = this;
				uni.chooseLocation({
					success: function(res) {
						console.log('位置名称：' + res.name);
						console.log('详细地址：' + res.address);
						console.log('纬度：' + res.latitude);
						console.log('经度：' + res.longitude);
						that.model.address = res.address;
						console.log(that.model);
						that.$forceUpdate()
					}
				});
			},
			chooseAvatar() {
				// 此为uView的跳转方法，详见"文档-JS"部分，也可以用uni的uni.navigateTo
				this.$u.route({
					// 关于此路径，请见下方"注意事项"
					url: '/uview-ui/components/u-avatar-cropper/u-avatar-cropper',
					// 内部已设置以下默认参数值，可不传这些参数
					params: {
						// 输出图片宽度，高等于宽，单位px
						destWidth: 300,
						// 裁剪框宽度，高等于宽，单位px
						rectWidth: 200,
						// 输出的图片类型，如果'png'类型发现裁剪的图片太大，改成"jpg"即可
						fileType: 'jpg',
					}
				})
			},
			change(e) {
				if (this.mode == 'range') {
					this.model.schedule = e.startDate + " - " + e.endDate;
				} else {
					this.model.schedule = e.result;
				}
			},
			handleClickWeight(e) {
				var model = encodeURIComponent(JSON.stringify(this.model));
				let url = encodeURIComponent(JSON.stringify("login/improveInformation"));
				uni.navigateTo({
					url: '../user/companyWeight?type=' + url + '&row=' + model
				})
			},
			handleClickCustom(e) {
				uni.navigateTo({
					url: '../user/companySetting?row=' + e
				})
			},
			handleAddTag() {
				if (this.tagValue === '') {
					this.$refs.uToast.show({
						title: '标签不能为空',
						type: 'warning',
					})
				} else {
					this.tagList.push(this.tagValue);
					this.tagValue = '';
					this.popupActive = false;
				}
			},
			tagClick(e) {
				console.log(e)
				this.tagList.splice(e, 1);
			},
			confirmQyfl(e) {
				this.model.industry = '';
				e.map((val, index) => {
					this.model.industry += this.model.industry == '' ? val.label : val.label;
					this.model.industryId = val.value;
				});
			},			
			async dictionaryFetchDict(keyWords) {
				let result = await this.$apis.fetchMultipleKey(keyWords);
				this.fetchDict = result.data;
			},
			avaUploadSuccess(data) {
				this.model.imgUrl = data.message;
				console.log(this.model.imgUrl)
			},
			avaUploadSuccess2(data) {
				this.model.proUrl = this.baseUrl + data.message;
				console.log(this.model.proUrl)
			},
			avaUploadSuccess3(data) {
				this.model.credentialsUrl = this.baseUrl + data.message;
				console.log(this.model.credentialsUrl)
			},
			avaUploadSuccess4(data) {
				console.log('this.uploadImageIndex', this.uploadImageIndex)
				console.log('this.infoList', this.infoList)
				if (this.infoList[this.uploadImageIndex].imgUrl === '') {
					this.infoList[this.uploadImageIndex].imgUrl = data.message;
				} else {
					this.infoList[this.uploadImageIndex].imgUrl = this.infoList[this.uploadImageIndex].imgUrl + ',' + data.message;
				}
			},
			async findUserInfoOne() {
				let that = this;
				let data = await this.$apis.findUserInfoOne();
				if (data.code === 200) {
					if(data.data.company.length > 0 && data.data.company != undefined) this.model = data.data.company;
				
					if(data.data.userInfo != undefined) this.model.industry = data.data.userInfo.userIdentify;
					this.infoList = data.data.products;
						
					for (let i = 0; i < this.infoList.length; i++) {
						if(this.infoList[i].imgUrl != undefined){
							if(this.infoList[i].imgUrl.split(',') != -1){
								this.infoList[i].arr = this.infoList[i].imgUrl.split(',');
								for (var j = 0; j < this.infoList[i].arr.length; j++) {
									this.infoList[i].arr[j] = that.baseUrl + this.infoList[i].arr[j]
								}
							}else{
								this.infoList[i].arr = [that.baseUrl + this.infoList[i].imgUrl];
							}
						}
					}

					if (this.model.imgUrl !== '') this.avatar = this.baseUrl + this.model.imgUrl;
					this.fileList = [{
						'url': that.baseUrl + this.model.qualificationUrl
					}]
					this.photos = [{
						'url': that.baseUrl + this.model.qualityUrl
					}]

					if (this.model.support == 1) {
						this.model.support = '是';
					} else {
						this.model.support = '否';
					}
					if (this.model.acceptRecruit == 1) {
						this.model.acceptRecruit = '是';
					} else {
						this.model.acceptRecruit = '否';
					}

					if (this.model.selfEvaluation != undefined && this.model.selfEvaluation.split(',') != -1) {							
						this.model.selfEvaluation.split(',').forEach(function(item) {
							that.tagList.push(item)
						})
					}

					// if(this.model.imgUrl!==null){
					// 	this.model.imgUrl=this.model.imgUrl;
					// }

				}
			},
			// checkbox选择发生变化
			checkboxGroupChange(e) {
				// this.model.zzsq = e;
				if (e === '是') {
					this.model.zzsq = 1;
				} else {
					this.model.zzsq = 0;
				}
			},
			// checkbox选择发生变化
			checkboxGroupChange1(e) {
				// this.model.jsyp = e;
				if (e === '是') {
					this.model.jsyp = 1;
				} else {
					this.model.jsyp = 0;
				}
			},
			submit() {

				this.$refs.uForm.validate(valid => {
					console.log(this.model);
					if (valid) {							
						this.save();
					} else {
						console.log('验证失败');
					}
				});

			},
			async save() {

				var company_type = this.fetchDict.company_type;
				for (var i in company_type) {
					if (company_type[i].name == this.model.industry) {
						this.model.industryId = company_type[i].id;
					}
				}
				this.model.acceptRecruit = this.model.acceptRecruit == '是' ? 1 : 0;
				this.model.support = this.model.support == '是' ? 1 : 0;
				console.log(this.model);
				let data = await this.$apis.companyInsert(this.model);
				console.log(JSON.stringify(data));
				// uni.setStorageSync("userInfo",data);
				if (data.code == 200) {
					// 前端自动登录
					//this.$store.commit('SET_USERINFO', data.data || {});
					uni.showToast({
						title: '完善信息成功',
						icon: 'none'
					});
					setTimeout(function(){
						uni.switchTab({
							url:'../tabBar/index'
						});
					},2000);
				} else {
					uni.showToast({
						title: result.message,
						icon: 'none'
					});
					return;
				}

			},
			selectConfirmQyxz(e) {
				this.model.type = '';
				e.map((val, index) => {
					this.model.type = this.model.type == '' ? val.label : '-' + val.label;
				});
			},
			selectConfirmZltx(e) {
				this.model.quality = '';
				e.map((val, index) => {
					this.model.quality = this.model.quality == '' ? val.label : val.label;
				});
			},
			selectConfirmScly(e) {
				this.model.scly = '';
				e.map((val, index) => {
					this.model.specials = this.model.specials == '' ? val.label : val.label;
				});
			},
			upload() {
				this.$refs.uUpload.upload();
				console.log('上传');
			},
			deleteItem(index) {
				this.$refs.uUpload.remove(index);
				console.log('删除');
			},
			onRemove(index, lists) {
				console.log('onRemove', index, lists);
				this.fileList.splice(index, 1);
				console.log(this.fileList);
				this.filePaths = this.fileList;
			},
			onSuccess(data, index, lists) {
				console.log('onSuccess', data, index, lists);
			},
			onUploaded(lists) {
				console.log('onUploaded', lists);
				var filePaths = [],
					fileNames = [];
				for (let i in lists) {
					console.log('data', lists[i].response);
					if (lists[i].response.code == 200) {
						filePaths.push(lists[i].response.message);
					}
				}
				this.filePaths = filePaths.join(',');
				this.model.qualificationUrl = this.filePaths;
			},
			onRemoveZl(index, lists) {
				console.log('onRemove', index, lists);
				this.fileListZl.splice(index, 1);
				console.log(this.fileList);
				this.filePathsZl = this.fileListZl;
			},
			onUploadedZl(lists) {
				var filePaths = [],
					fileNames = [];
				for (let i in lists) {
					console.log('data', lists[i].response);
					if (lists[i].response.code == 200) {
						filePaths.push(lists[i].response.message);
					}
				}
				this.filePathsZl = filePaths.join(',');
				this.model.qualityUrl = this.filePathsZl;
			},
			onRemoveZz(index, lists) {
				console.log('onRemove', index, lists);
				this.fileListZz.splice(index, 1);
				console.log(this.fileList);
				this.filePathsZz = this.fileListZz;
			},
			onUploadedZz(lists) {
				var filePaths = [],
					fileNames = [];
				for (let i in lists) {
					if (lists[i].response.code == 200) {
						filePaths.push(lists[i].response.message);
					}
				}
				this.filePathsZz = filePaths.join(',');
				this.model.enterpriseQualificationUrl = this.filePathsZz;
			}
		}
	};
</script>

<style lang="scss" scoped>
	.container {background-color: #fff;}
	.fgx {
		// margin-top: 29rpx;
		// width: 100%;
		height: 20rpx;
		background-color: #f5f5f9;
	}
	
	.group {
		padding: 6rpx 21rpx;
		background: #f1f7ff;
		border-radius: 6rpx;
		margin: 30rpx 30rpx 0 30rpx;
	}
	
	.sctp {
		display: flex;
		flex-direction: column;
	
		.hz {
			color: #0d1d36;
			font-size: 30rpx;
		}
	
		.sm {
			color: #9da2b0;
			font-size: 26rpx;
			line-height: 44rpx;
			margin-top: 38rpx;
		}
	}
	
	.gsdw {
		display: flex;
		justify-content: flex-end;
		align-items: center;
		margin-right: 34rpx;
		margin-top: 40rpx;
	
		.picture {
			width: 29rpx;
			height: 29rpx;
		}
	
		.hz {
			font-size: 30rpx;
			color: #0567ff;
			margin-left: 16rpx;
		}
	}
	
	.zwpj {
		width: 690rpx;
		height: 260rpx;
		background-color: #f5f5f9;
		margin-top: 40rpx;
		font-size: 30rpx;
		color: #f5f5f9;
		border-radius: 10rpx;
		line-height: 44rpx;
	}
	
	.button {
		width: 662rpx;
		margin: 132rpx auto 70rpx auto;
		background: #ab61ff;
		border-radius: 40rpx;
		border: 0;
		color: #fff;
	
		&.u-hairline-border:after {
			border: 0;
		}
	}
	
	.avatar {
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
	
		.name {
			color: #4B9CFF;
			font-size: 30upx;
			margin-top: 40upx;
		}
	
		.topic {
			width: 115upx;
			height: 132upx;
			margin-left: -20upx;
		}
	}
	
	.u-form-item {
		padding: 10upx 20upx;
	
		.scroll-view_H {
			width: 380upx;
			white-space: nowrap;
		}
	}
	
	.f-logo {
		width: 115rpx;
		height: 132rpx;
		overflow: hidden;
		background-repeat: no-repeat;
		background-position: center 0;
		background-size: 115% auto;
	
		image {
			width: 115rpx;
			height: 132rpx;
		}
	}
</style>
